package cn.signalpha.modules.shop.dto;

import cn.signalpha.modules.shop.entity.Goods;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.List;

/**
 * 数据传输对象实体类
 *
 * @author suguangjun
 */
@Data
public class OrderDTO implements Serializable {
	private static final long serialVersionUID = 1L;

	@Data
	@ApiModel(value= "提交订单参数")
	public static class OrderSubmitDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "每个商户提交的订单信息",required=true)
		private List<OrderShopDTO> orderShopList;
	}

	@Data
	@ApiModel(value= "每个商户提交的订单信息")
	public static class OrderShopDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "商户id", required=true)
		private Long sellerId;
		@ApiModelProperty(value = "商家地址id，自提需要传入")
		private Long sellerAddressId;
		@ApiModelProperty(value = "订单备注信息", required=true)
		private String remarks;
		@ApiModelProperty(value = "配送日期 yyyy-MM-dd")
		private String deliveryDate;
		@ApiModelProperty(value = "配送开始时间 HH:mm")
		private String deliveryBeginTime;
		@ApiModelProperty(value = "配送结束时间 HH:mm")
		private String deliveryEndTime;
	}

	@Data
	public static class RemarkDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "订单id")
		private Long id;
		@ApiModelProperty(value = "备注")
		private String remark;
	}

	@Data
	public static class UpdateUserAddressDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "订单id")
		private Long id;
		@NotNull
		@ApiModelProperty(value = "地址id")
		private Long addressId;
	}

	@Data
	@EqualsAndHashCode(callSuper = true)
	public static class DetailDTO extends Goods {
		private static final long serialVersionUID = 1L;
		@ApiModelProperty(value = "商品数量")
		private Integer goodsNum;
		@ApiModelProperty(value = "规格ID")
		private Long goodsSkuId;
		@ApiModelProperty(value = "购买规格")
		private String goodsSpec;
		@ApiModelProperty(value = "规格图片")
		private String goodsSpecImg;
		@ApiModelProperty(value = "商品总价")
		private Double goodsPriceTotal;
	}

	@Data
	public static class CommentDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "订单id")
		private Long id;
		@ApiModelProperty(value = "详情评论")
		private List<CommentDetailDTO> detailList;
	}

	@Data
	public static class CommentDetailDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "订单详情id")
		private Long id;
		@NotBlank
		@ApiModelProperty(value = "评价内容")
		private String content;
		@NotNull
		@ApiModelProperty(value = "商品评分")
		private Integer goodsScore;
		@ApiModelProperty(value = "评论图片")
		private String img;
	}

	@Data
	public static class RefundDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "订单id")
		private Long id;
		@ApiModelProperty(value = "退款明细")
		private List<RefundDetailDTO> detailList;
	}

	@Data
	public static class RefundDetailDTO implements Serializable {
		private static final long serialVersionUID = 1L;
		@NotNull
		@ApiModelProperty(value = "订单详情id")
		private Long orderDetailId;
		@Min(1)
		@NotNull
		@ApiModelProperty(value = "退款数量")
		private Integer goodsNum;
	}

}
